// run: $exec < input
#include <iostream>
#include <cstring>
#include <string>

int const maxn = 2007;
int father[maxn];
bool vis[maxn];
int n;
std::string s;

int get_father(int x)
{
	return x == father[x] ? x : (father[x] = get_father(father[x]));
}

void set_union(int x, int y)
{
	int tx = get_father(x);
	int ty = get_father(y);
	if (tx != ty) father[tx] = ty;
}

bool judge()
{
	for(int i = 1; i <= n; i++)
		if (get_father(i) == get_father(n + i)) return false;
	return true;
}

int main()
{
	while (std::cin >> n && n) {
		for (int i = 1; i <= 2 * n; i++) father[i] = i;
		for (int i = 1, x; i <= n; i++) {
			std::cin >> s >> x >> s;
			std::cin >> s;
			if (s[0] == 't') {
				set_union(i, x);
				set_union(i + n, x + n);
			} else {
				set_union(i, x + n);
				set_union(i + n, x);
			}
		}
		if (!judge())
			std::cout << "Inconsistent\n";
		else {
			int ans = 0;
			for (int i = 1; i <= 2 * n; i++)
				father[i] = get_father(father[i]);
			std::memset(vis, 0, sizeof(vis));
			for (int i = 1; i <= n; i++){
				if (vis[i]) continue;
				vis[i] = vis[n + i] = true;
				int t1 = 0, t2 = 0;
				for (int j = 1; j <= n; j++)
					if (father[j] == father[i]) {
						vis[j] = true;
						t1++;
					}
				for (int j = n + 1; j <= 2 * n; j++)
					if (father[j] == father[i]) {
						vis[j - n] = true;
						t2++;
					}
				ans += std::max(t1, t2);
			}
			std::cout << ans << '\n';
		}
	}
}

